<!doctype html> 
<html> 
<head> 
    <meta charset="utf-8"> 
    <title></title>
    <style type="text/css">
*{margin: 0;padding: 0;list-style: none;}
#div1{
	width: 200px;height: 200px;background:black;position: absolute;left: 50%;top: 50%;margin: -100px 0 0 0px;
	transform:perspective(800px);
	-transition:1s transform ease;
	transform-origin:30px 20px;
}

#div1:active{
	transform:rotateY(-180deg);
}

    </style> 
</head>
<body>

<div id='div1'></div>
<script type="text/javascript">
	
	var a = 0;
	setInterval(function(){
		a+=2;
		div1.style.transform = 'perspective(800px) rotateY('+a+'deg)';
	},0);
</script>
</body>
</html>